  layui.use(['form', 'element', 'jquery'], function() {
    var form = layui.form,
        element = layui.element,
        $ = layui.jquery;
    $('form').submit(function(event) {
        event.preventDefault();
        var ii = layer.load(2, {
            shade: [0.1, '#fff']
        });
        $.ajax({
            type: 'POST',
            url: '/h/ajax/updatePwd',
            data: $(this).serialize(),
            dataType: 'json',
            success: function(data) {
                layer.close(ii);
                if (data.code == 200) {
                    layer.msg(data.msg,{
                        icon: 1,
                        time: 1000
                    },function(){
                        window.parent.location = "./index";
                    })
                    
                } else {
                    layer.msg(data.msg, {
                        icon: 2,
                        time: 1000
                    });
                }
            },
            error: function(data) {
                layer.close(ii);
                layer.msg("服务器错误！", {
                    icon: 2,
                    time: 1000
                });
                return false;
            }
        });
        return false;
    });
});